package com.santu.edu.supporter.biz.buildings.pojo.enums;

import com.santu.edu.supporter.exception.BizException;
import com.santu.edu.supporter.exception.CustomError;

/**
 * @author luoyaoqi
 * @createTime 2024/2/20
 * @description
 */
public enum BuildingsType {

    /**
     *
     */
    DORMITORY(1,"宿舍"),
    STUDY_BUILDINGS(2, "教学楼"),
    LIBRARY(3, "图书馆"),
    CAFETERIA(4, "食堂"),
    SUPERMARKET(5,"超市"),
    KD(6, "快递点"),
    OTHER(7, "其他"),
    ALL(-1,"全部"),
    ;

    private Integer code;

    private String desc;


    BuildingsType(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static BuildingsType convert(Integer code) {
        for (BuildingsType item : BuildingsType.values()) {
            if (item.getCode().equals(code)) {
                return item;
            }
        }
        throw BizException.causeBy(CustomError.ENUM_CONVERT_ERROR,"TimeSectionType转换异常");
    }

}
